<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__.'/Applications/function.php';
$time = get_microtime();
echo "初始: ".memory_get_usage()."B\n";

/**
 * 循环10000次 750毫秒
 * 循环100000次 4150 毫秒
 */
for($i=0;$i<1;$i++){
    $rsp = Applications\Tool\Protobuf::createRsp('ping', new Pb\App\ResponseData\Ping());
    $string = $rsp->serializeToString();
    echo strlen($string). " \n";
    $rsp2 = new Pb\App\MessageResponse();
    $rsp2->mergeFromString($string);
//    echo $rsp2->serializeToJsonString();
    echo "使用: ".memory_get_usage()."B\n";
    
}
echo "释放: ".memory_get_usage()."B\n";
echo "峰值: ".memory_get_peak_usage()."B\n";

echo get_microtime()-$time." \n";